package com.lkcg.demo.util;

import com.alibaba.fastjson.JSON;
import org.apache.log4j.Logger;

import java.util.Collections;
import java.util.Map;

/**
 * Created by chenzhuobin on 2017/5/11.
 */
public class JsonUtil {
    private static final Logger logger = Logger.getLogger(JsonUtil.class);
    private JsonUtil() {
        throw new IllegalAccessError("Utility class");
    }
    /**
     * 通过传进来的转成Map，成功返回true，失败为false
     * @param json
     * @return
     */
    public static Map jsonToMap(String json){
        try {
            return JSON.parseObject(json,Map.class);
        }catch (Exception e){
            logger.error("json trancation map error",e);
        }
        return Collections.emptyMap();
    }
}
